package com.itheima.jdk8_DateDemo;

import java.sql.SQLOutput;
import java.time.LocalDate;
import java.time.Period;

public class Test7 {
    public static void main(String[] args) {
        LocalDate localDate = LocalDate.of(2020, 1, 1);
        LocalDate localDate1 = LocalDate.of(2048, 10, 1);
        Period period = Period.between(localDate, localDate1);
        System.out.println(period);
        //P28Y9M
        System.out.println(period.getYears());
        System.out.println(period.getMonths());
        //获得此期间相差的总月数
        System.out.println(period.toTotalMonths());
        //获得此期间的天数,不是总天数
        System.out.println(period.getDays());


    }
}
